package com.scjp.chapter5.self_test;

public class Ebb {

	static int x = 7;

	public static void main(String[] args) {
		String s = "";
		for (int y = 0; y < 3; y++) {
			x++;
			System.out.println("x before switch = " + x);
			switch (x) {
			case 8:
				s += "8 ";
				System.out.println("x in 8 = " + x);
			case 9:
				s += "9 ";
				System.out.println("x in 9 = " + x);
			case 10: {
				s += "10 ";
				System.out.println("x in 10 = " + x);
				break;
			}
			default:
				s += "d ";
				System.out.println("x in default = " + x);
			case 13:
				s += "13 ";
				System.out.println("x in 13 = " + x);
			}
		}
		System.out.println("s = " + s);
		System.out.println("x final value = " + x);
	}

	/**
	 * Do not forget the static blocks !
	 * Here, the main idea is that x = 7 initially;
	 * after he passes the static block x = 8;
	 * after he passes the for x = 9;
	 */
	static {
		x++;
	}

}
